package swing.frame.whiteboard;

import javax.swing.*;
import java.awt.*;
import java.util.List;

/**
 * @author ywjia
 */
public class StaffPanel extends JPanel {
    JScrollPane scrollPane;
    JList members;
    JPanel panel=new JPanel();
    public void init(){
        this.setLayout(new FlowLayout(FlowLayout.CENTER));
        //JButton
        this.scrollPane=new JScrollPane();
        scrollPane.setPreferredSize(new Dimension(100,593));
        this.members=new JList();
        JButton bt=new JButton("在线成员：  ");
        bt.setPreferredSize(new Dimension(94, 30));
        scrollPane.setViewportView(members);

        panel.add(bt);
        panel.add(scrollPane);
        panel.setPreferredSize(new Dimension(100,800));
        this.add(panel);
    }
    public StaffPanel(){
        init();
    }
    public void setMembersList(List<String> list){
        String[] str=new String[list.size()+1];
//        str[0]="在线成员：";
        int i=0;
        for (String cc : list) {
            str[i]=cc;
            i++;
        }
        members.setListData(str);
        scrollPane.setViewportView(members);
    }
}
